using System;
using System.Collections.Generic;
using System.Data.Linq.Mapping;
using InfoTech.Core.Data.Attributes;
using InfoTech.Core.Data.Dataable;
using InfoTech.Core.Data.Persistence;
using InfoTech.Utilities.Generic;

namespace InfoTech.LanTranh.MucVu.Bussiness
{
	[Serializable]
	[ExtraTable(Name = "HOGIADINH", Schema="dbo")]
	[Table(Name = "[dbo].[HOGIADINH]")]
	public partial class HOGIADINH : ObjPersistence, IDeleteable, IUpdateable, IInsertable, ISelectable, IDeleteablebyId, IUpdateablebyId, ISelectablebyId
	{

		#region Fields

		private System.Guid _mahogiadinh;

		private System.String _dienthoai;

		private System.String _diachi;

		private System.String _fax;

		private System.String _khuxom;

		private System.String _email;

		private System.Int32? _kinhte;

		private System.Guid? _maquocgia;

		private System.Guid? _matinhthanh;

		private System.Guid? _maquanhuyen;

		private System.Guid? _maxaphuong;

		private System.Guid? _magiaophan;

		private System.Guid? _magiaohat;

		private System.Guid? _magiaoxu;

		private System.Guid? _magiaoho;

		private System.Guid? _machuho;

		private System.Guid? _mahoancanhkinhte;

		private System.Int32? _hogiadinhid;

		private IEnumerable<HOGIADINH_DIACHI> _ref_hogiadinh_diachi;

		private IEnumerable<HOGIADINH_GIAODAN> _ref_hogiadinh_giaodan;

		private HOANCANHKINHTE _prt_hoancanhkinhte;

		private XAPHUONG _prt_xaphuong;

		private QUOCGIA _prt_quocgia;

		private GIAOXU _prt_giaoxu;

		private GIAOHO _prt_giaoho;

		private GIAOPHAN _prt_giaophan;

		private GIAODAN _prt_giaodan;

		private QUANHUYEN _prt_quanhuyen;

		private GIAOHAT _prt_giaohat;

		private TINHTHANH _prt_tinhthanh;

		#endregion

		#region Properties

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = false)]
		[Column(Name = "MAHOGIADINH", DbType = "uniqueidentifier", IsPrimaryKey = true, CanBeNull = false)]
		public System.Guid MAHOGIADINH
		{
			get
			{
				return _mahogiadinh;
			}
			set
			{
				OnChanged(this, "MAHOGIADINH");
				_mahogiadinh = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 20, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "DIENTHOAI", DbType = "nvarchar(20)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String DIENTHOAI
		{
			get
			{
				return _dienthoai;
			}
			set
			{
				OnChanged(this, "DIENTHOAI");
				_dienthoai = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 1000, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "DIACHI", DbType = "nvarchar(1000)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String DIACHI
		{
			get
			{
				return _diachi;
			}
			set
			{
				OnChanged(this, "DIACHI");
				_diachi = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 20, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "FAX", DbType = "nvarchar(20)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String FAX
		{
			get
			{
				return _fax;
			}
			set
			{
				OnChanged(this, "FAX");
				_fax = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 1000, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "KHUXOM", DbType = "nvarchar(1000)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String KHUXOM
		{
			get
			{
				return _khuxom;
			}
			set
			{
				OnChanged(this, "KHUXOM");
				_khuxom = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 1000, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "EMAIL", DbType = "nvarchar(1000)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String EMAIL
		{
			get
			{
				return _email;
			}
			set
			{
				OnChanged(this, "EMAIL");
				_email = value;
			}
		}

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = true)]
		[Column(Name = "KINHTE", DbType = "int", IsPrimaryKey = false, CanBeNull = true)]
		public System.Int32? KINHTE
		{
			get
			{
				return _kinhte;
			}
			set
			{
				OnChanged(this, "KINHTE");
				_kinhte = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAQUOCGIA", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAQUOCGIA
		{
			get
			{
				return _maquocgia;
			}
			set
			{
				OnChanged(this, "MAQUOCGIA");
				_maquocgia = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MATINHTHANH", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MATINHTHANH
		{
			get
			{
				return _matinhthanh;
			}
			set
			{
				OnChanged(this, "MATINHTHANH");
				_matinhthanh = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAQUANHUYEN", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAQUANHUYEN
		{
			get
			{
				return _maquanhuyen;
			}
			set
			{
				OnChanged(this, "MAQUANHUYEN");
				_maquanhuyen = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAXAPHUONG", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAXAPHUONG
		{
			get
			{
				return _maxaphuong;
			}
			set
			{
				OnChanged(this, "MAXAPHUONG");
				_maxaphuong = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAGIAOPHAN", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAGIAOPHAN
		{
			get
			{
				return _magiaophan;
			}
			set
			{
				OnChanged(this, "MAGIAOPHAN");
				_magiaophan = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAGIAOHAT", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAGIAOHAT
		{
			get
			{
				return _magiaohat;
			}
			set
			{
				OnChanged(this, "MAGIAOHAT");
				_magiaohat = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAGIAOXU", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAGIAOXU
		{
			get
			{
				return _magiaoxu;
			}
			set
			{
				OnChanged(this, "MAGIAOXU");
				_magiaoxu = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAGIAOHO", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAGIAOHO
		{
			get
			{
				return _magiaoho;
			}
			set
			{
				OnChanged(this, "MAGIAOHO");
				_magiaoho = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MACHUHO", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MACHUHO
		{
			get
			{
				return _machuho;
			}
			set
			{
				OnChanged(this, "MACHUHO");
				_machuho = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAHOANCANHKINHTE", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAHOANCANHKINHTE
		{
			get
			{
				return _mahoancanhkinhte;
			}
			set
			{
				OnChanged(this, "MAHOANCANHKINHTE");
				_mahoancanhkinhte = value;
			}
		}

		[ExtraColumn(DbType = "int", Length = 0, TypeName = "System.Int32", Type = typeof(System.Int32), CanBeNull = true)]
		[Column(Name = "HOGIADINHID", DbType = "int", IsPrimaryKey = false, CanBeNull = true)]
		public System.Int32? HOGIADINHID
		{
			get
			{
				return _hogiadinhid;
			}
			set
			{
				OnChanged(this, "HOGIADINHID");
				_hogiadinhid = value;
			}
		}

		public IEnumerable<HOGIADINH_DIACHI> REF_HOGIADINH_DIACHI
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _ref_hogiadinh_diachi == null))
					InfoTech.Core.Data.Receiver.TypeObject<HOGIADINH_DIACHI>.Select(this, "REF_HOGIADINH_DIACHI", new[] { new Vector<string, string>("MAHOGIADINH", "MAHOGIADINH"), }, InfoTech.Core.Data.RelationType.OnetoMany);
				return _ref_hogiadinh_diachi;
			}
			set
			{
				_ref_hogiadinh_diachi = value;
			}
		}

		public IEnumerable<HOGIADINH_GIAODAN> REF_HOGIADINH_GIAODAN
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _ref_hogiadinh_giaodan == null))
					InfoTech.Core.Data.Receiver.TypeObject<HOGIADINH_GIAODAN>.Select(this, "REF_HOGIADINH_GIAODAN", new[] { new Vector<string, string>("MAHOGIADINH", "MAHOGIADINH"), }, InfoTech.Core.Data.RelationType.OnetoMany);
				return _ref_hogiadinh_giaodan;
			}
			set
			{
				_ref_hogiadinh_giaodan = value;
			}
		}

		public HOANCANHKINHTE PRT_HOANCANHKINHTE
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_hoancanhkinhte == default(HOANCANHKINHTE)))
					InfoTech.Core.Data.Receiver.TypeObject<HOANCANHKINHTE>.Select(this, "PRT_HOANCANHKINHTE", new[] { new Vector<string, string>("MAHOANCANHKINHTE", "MAHOANCANHKINHTE"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_hoancanhkinhte;
			}
			set
			{
				_prt_hoancanhkinhte = value;
			}
		}

		public XAPHUONG PRT_XAPHUONG
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_xaphuong == default(XAPHUONG)))
					InfoTech.Core.Data.Receiver.TypeObject<XAPHUONG>.Select(this, "PRT_XAPHUONG", new[] { new Vector<string, string>("MAXAPHUONG", "MAXAPHUONG"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_xaphuong;
			}
			set
			{
				_prt_xaphuong = value;
			}
		}

		public QUOCGIA PRT_QUOCGIA
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_quocgia == default(QUOCGIA)))
					InfoTech.Core.Data.Receiver.TypeObject<QUOCGIA>.Select(this, "PRT_QUOCGIA", new[] { new Vector<string, string>("MAQUOCGIA", "MAQUOCGIA"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_quocgia;
			}
			set
			{
				_prt_quocgia = value;
			}
		}

		public GIAOXU PRT_GIAOXU
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_giaoxu == default(GIAOXU)))
					InfoTech.Core.Data.Receiver.TypeObject<GIAOXU>.Select(this, "PRT_GIAOXU", new[] { new Vector<string, string>("MAGIAOXU", "MAGIAOXU"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_giaoxu;
			}
			set
			{
				_prt_giaoxu = value;
			}
		}

		public GIAOHO PRT_GIAOHO
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_giaoho == default(GIAOHO)))
					InfoTech.Core.Data.Receiver.TypeObject<GIAOHO>.Select(this, "PRT_GIAOHO", new[] { new Vector<string, string>("MAGIAOHO", "MAGIAOHO"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_giaoho;
			}
			set
			{
				_prt_giaoho = value;
			}
		}

		public GIAOPHAN PRT_GIAOPHAN
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_giaophan == default(GIAOPHAN)))
					InfoTech.Core.Data.Receiver.TypeObject<GIAOPHAN>.Select(this, "PRT_GIAOPHAN", new[] { new Vector<string, string>("MAGIAOPHAN", "MAGIAOPHAN"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_giaophan;
			}
			set
			{
				_prt_giaophan = value;
			}
		}

		public GIAODAN PRT_GIAODAN
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_giaodan == default(GIAODAN)))
					InfoTech.Core.Data.Receiver.TypeObject<GIAODAN>.Select(this, "PRT_GIAODAN", new[] { new Vector<string, string>("MACHUHO", "MAGIAODAN"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_giaodan;
			}
			set
			{
				_prt_giaodan = value;
			}
		}

		public QUANHUYEN PRT_QUANHUYEN
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_quanhuyen == default(QUANHUYEN)))
					InfoTech.Core.Data.Receiver.TypeObject<QUANHUYEN>.Select(this, "PRT_QUANHUYEN", new[] { new Vector<string, string>("MAQUANHUYEN", "MAQUANHUYEN"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_quanhuyen;
			}
			set
			{
				_prt_quanhuyen = value;
			}
		}

		public GIAOHAT PRT_GIAOHAT
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_giaohat == default(GIAOHAT)))
					InfoTech.Core.Data.Receiver.TypeObject<GIAOHAT>.Select(this, "PRT_GIAOHAT", new[] { new Vector<string, string>("MAGIAOHAT", "MAGIAOHAT"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_giaohat;
			}
			set
			{
				_prt_giaohat = value;
			}
		}

		public TINHTHANH PRT_TINHTHANH
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_tinhthanh == default(TINHTHANH)))
					InfoTech.Core.Data.Receiver.TypeObject<TINHTHANH>.Select(this, "PRT_TINHTHANH", new[] { new Vector<string, string>("MATINHTHANH", "MATINHTHANH"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_tinhthanh;
			}
			set
			{
				_prt_tinhthanh = value;
			}
		}

		#endregion

		#region Reflector

		public System.Type Reflector()
		{
			return typeof(HOGIADINH);
		}
		public object Current
		{
			get { return this; }
		}

		#endregion

	}
}
